Cleaning scripts:

Load data:

Compare probability ratings

compare_probabilities = function(d) {
  d = d %>%
    mutate(prob_diff = abs(100*prob_rating - prob))
  
  d_mean_overall = d %>%
    group_by(workerid) %>%
    summarise(by_worker = mean(prob_diff))
  
  d_mean_by_prob = d %>%
    group_by(prob) %>%
    summarize(by_prob = mean(prob_diff))
  
  d_mean_by_probworker = d %>%
    group_by(workerid, prob) %>%
    summarize(by_probworker = mean(prob_diff))
  
  return(d_mean_by_probworker)
  
}

compare_probabilities(exp_trials1)
## # A tibble: 30 x 3
## # Groups:   workerid [10]
##    workerid  prob by_probworker
##       <int> <dbl>         <dbl>
##  1        0    25          8.6 
##  2        0    60          3.40
##  3        0   100          1   
##  4        1    25         19.4 
##  5        1    60         19   
##  6        1   100         54.7 
##  7        2    25         16.2 
##  8        2    60         12.6 
##  9        2   100          2   
## 10        3    25         52   
## # … with 20 more rows
compare_probabilities(exp_trials2)
## # A tibble: 30 x 3
## # Groups:   workerid [10]
##    workerid  prob by_probworker
##       <int> <dbl>         <dbl>
##  1        0    25         13   
##  2        0    60         13.4 
##  3        0   100         21.3 
##  4        1    25          5   
##  5        1    60          6.60
##  6        1   100          7   
##  7        2    25         36.8 
##  8        2    60         40.8 
##  9        2   100          3   
## 10        3    25         43   
## # … with 20 more rows
compare_probabilities(exp_trials3)
## # A tibble: 30 x 3
## # Groups:   workerid [10]
##    workerid  prob by_probworker
##       <int> <dbl>         <dbl>
##  1        0    60           7.6
##  2        0    90          15.4
##  3        0   100           0  
##  4        1    60          16.8
##  5        1    90          47.8
##  6        1   100          74  
##  7        2    60          18.4
##  8        2    90          24.3
##  9        2   100          33.7
## 10        3    60           7.6
## # … with 20 more rows
compare_probabilities(exp_trials4)
## # A tibble: 30 x 3
## # Groups:   workerid [10]
##    workerid  prob by_probworker
##       <int> <dbl>         <dbl>
##  1        0    60          6.8 
##  2        0    90          7.12
##  3        0   100          0   
##  4        1    60         16.2 
##  5        1    90         12.1 
##  6        1   100          9   
##  7        2    60         17.2 
##  8        2    90         10.1 
##  9        2   100          1.67
## 10        3    60         15.7 
## # … with 20 more rows

Visualize mood ratings

mood1 = format_mood(read.csv("../data/pilot3/04_exp_away_cond1-mood_ratings.csv"))
mood1$Answer.condition = "Optimist"
mood2 = format_mood(read.csv("../data/pilot3/04_exp_away_cond2-mood_ratings.csv"))
mood2$Answer.condition = "Confident"
mood3 = format_mood(read.csv("../data/pilot3/04_exp_away_cond3-mood_ratings.csv"))
mood3$Answer.condition = "Pessimist"
mood4 = format_mood(read.csv("../data/pilot3/04_exp_away_cond4-mood_ratings.csv"))
mood4$Answer.condition = "Cautious"




mood2$workerid = mood2$workerid + max(mood1$workerid) + 1
mood3$workerid = mood3$workerid + max(mood2$workerid) + 1
mood4$workerid = mood4$workerid + max(mood3$workerid) + 1

mood_all = rbind(mood1, mood2, mood3, mood4)

mood1_all = mood_all %>%
  filter(type == "mood1") %>%
  mutate(mood1 = mood_rating) %>%
  mutate(mood_rating = NULL) %>%
  mutate(type = NULL)

mood2_all = mood_all %>%
  filter(type == "mood2") %>%
  mutate(mood2 = mood_rating) %>%
  mutate(mood_rating = NULL) %>%
  mutate(type = NULL)


mood_all = merge(mood1_all, mood2_all)

mood_by_participant = mood_all

mood_by_participant$diff = mood_all$mood2 - mood_all$mood1

moodp1 = ggplot(data = mood_by_participant) +
  geom_bar(mapping = aes(x = workerid, y = diff, fill = Answer.condition), stat = "identity")

moodp1

Exclude random responses

exclude_random = function(d) {
  d_overall_means = d %>%
  group_by(modal, workerid) %>% 
  summarise(rating_m_overall = mean(rating))

  d_indiv_means =  d %>%
    group_by(modal,percent_window, workerid) %>% 
    summarise(rating_m = mean(rating))
  
  d_indiv_merged = merge(d_indiv_means, d_overall_means, by=c("workerid", "modal"))
  
  cors = d_indiv_merged %>%
    group_by(workerid) %>%
    summarise(corr = cor(rating_m, rating_m_overall))
  
  exclude = cors %>%
    filter(corr > 0.75) %>%
    .$workerid
  
  print(paste("Excluded", length(exclude), "participants based on random responses."))
  
  d = d %>% filter(!(workerid %in% exclude))
}

d1 = exclude_random(d1)
## [1] "Excluded 2 participants based on random responses."
d2 = exclude_random(d2)
## [1] "Excluded 1 participants based on random responses."
d3 = exclude_random(d3)
## [1] "Excluded 1 participants based on random responses."
d4 = exclude_random(d4)
## [1] "Excluded 4 participants based on random responses."

Aggregated results

## Individual plots

plot(ps1$by_participant)

plot(ps2$by_participant)

plot(ps3$by_participant)

plot(ps4$by_participant)

AUC Computation

So, we’re seeing what we expected for the confident speaker, with the AUC > in the optimistic condition than in the confident condition (indicating explaining away), but we’re not seeing the same (with just one speaker) for the pessimistic/cautious condition, where we would expect flipped results, with the pessimistic condition having a lower AUC than the cautious condition (with adaptation). To sum up, we expect the order to be, from greater to lower difference, “cautious”, “pessimistic”, “optimistic”, and “confident”.

## 
##  Two Sample t-test
## 
## data:  aucs.confident$auc_diff and aucs.cautious$auc_diff
## t = -1.2943, df = 13, p-value = 0.2181
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -33.984306   8.519722
## sample estimates:
## mean of x mean of y 
##   3.14106  15.87335
## 
##  Two Sample t-test
## 
## data:  aucs.pessimist$auc_diff and aucs.cautious$auc_diff
## t = -1.1534, df = 13, p-value = 0.2695
## alternative hypothesis: true difference in means is not equal to 0
## 95 percent confidence interval:
##  -49.80913  15.13535
## sample estimates:
## mean of x mean of y 
## -1.463541 15.873352

Power analysis

m.cautious = mean(aucs.cautious$auc_diff)
m.pessimist = mean(aucs.pessimist$auc_diff)

sd.cautious = sd(aucs.cautious$auc_diff)
sd.pessimist = sd(aucs.pessimist$auc_diff)

d = m.cautious - m.pessimist
d = d/sd.pessimist

d
## [1] 0.5629496
power.t.test(n=60, delta=d, sd=1, sig.level = 0.05, type="two.sample", alternative="two.sided")
## 
##      Two-sample t test power calculation 
## 
##               n = 60
##           delta = 0.5629496
##              sd = 1
##       sig.level = 0.05
##           power = 0.863952
##     alternative = two.sided
## 
## NOTE: n is number in *each* group